import request from '@/utils/request';
import requestMock from '@/utils/requestMock';
//项目前部的接口在这里统一管理，将来某一个组件|其他文件向发请求，直接找当前文件即可！！！

//封装成功函数:获取商品分类三级数据
//下面写法:分别暴露，别的文件引入的时候，{}
export const reqCategoryList = () => request({ url: '/product/getBaseCategoryList', method: 'get' });


//首页轮播图的接口
export const reqBannerList = () => requestMock({ url: '/banner', method: 'get' });

//首页Floor的接口
export const reqFloorList = () => requestMock({ url: '/floor', method: 'get' });


//将来搜索模块搜索商品需要接口
//data:就是将来请求体需要携带参数 对象:最多十个K
//搜索接口data:至少传递一个空对象
export const reqSearchList = data => request({ url: "/list", method: 'post', data })

//获取详情页数据
export const reqGoodDetail = skuId => request({url:`/item/${skuId}`,methods:'get'});

//将商品加入某一个用户的购物车+修改某一个已有的商品数量
export const reqAddOrUpdateCart = (skuId,skuNum)=>request({url: `/cart/addToCart/${skuId}/${skuNum}`,method:'post'})

//获取某一个用户的购物车接口
export const reqUserCartList = ()=>request({url:`/cart/cartList`,method:'get'});

//修改某一个商品勾选状态
export const reqUpdateChecked = (skuId,isChecked)=>request({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'})

//删除某一个商品

export const reqDeleteGoodById = (skuId)=>request({url:`/cart/deleteCart/${skuId}`,method:'delete'})

//获取验证码
export const reqGetUserCode = (phone)=>request({url:`/user/passport/sendCode/${phone}`,method:'get'});

//注册接口
export const reqUserRegister = (data)=>request({url:`/user/passport/register`,method:'post',data});
//登录接口
export const reqUserLogin = (data)=>request({url:`/user/passport/login`,method:'post',data});

//获取用户信息:登录以后获取用户信息
//携带token
export const reqUserInfo = ()=>request({url:`/user/passport/auth/getUserInfo`,method:'get'});

//退出登录，告诉服务器小兄弟次token清理
export const reqLogOut = ()=>request({url:'/user/passport/logout',method:'get'});

//获取交易页面的数据 收件人地址 商品清单
export const reqTradeInfo=()=>request({url:`/order/auth/trade`,method:'get'});

//提交订单
export const reqSubmitOrder=(tradeNo,data)=>request({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,method:'post',data})

//获取支付订单信息
export const reqPayInfo = (orderId)=>request({url:`/payment/weixin/createNative/${orderId}`,method:'get'})

//查询用户订单支付情况
export const reqPayResult = (orderId)=>request({url:`/payment/weixin/queryPayStatus/${orderId}`,method:'get'});

//个人中心我的订单的查询接口
export const reqMyOrder = (page,limit)=>request({url:`/order/auth/${page}/${limit}`,method:'get'})